package aad.storyboard.model;

import java.util.ArrayList;

import utils.ViewUtils;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;

/**
 *  abstract class for objects that can be displayed
 */

public abstract class GraphicalObject{
	protected float posX;
	protected float posY;
	private boolean visible;
	private boolean clickable;
	protected Paint paint;
	private boolean valid;
	
	private Bitmap fadeTarget;
	 private Paint fadePaint;
	
	public GraphicalObject(){
		paint = new Paint();
	}
	
	//getters and setters
	public int getPosX() {
		return Math.round(posX);
	}
	public void setPosX(float posX) {
		this.posX = posX;
	}
	public int getPosY() {
		return Math.round(posY);
	}
	public void setPosY(float posY) {
		this.posY = posY;
	}
	public boolean isVisible() {
		return visible;
	}
	public void setVisible(boolean visible) {
		this.visible = visible;
	}
	public boolean isClickable() {
		return clickable;
	}
	public void setClickable(boolean clickable) {
		this.clickable = clickable;
	}
	public Paint getPaint() {
		return paint;
	}
	public void setPaint(Paint paint) {
		this.paint = paint;
	}
	public void validate(){
		this.valid = true;
	}
	public void invalidate(){
		this.valid = false;
	}
	public boolean isValid(){
		return this.valid;
	}
	public float getPreciseX(){
		return this.posX;
	}
	public float getPreciseY(){
		return this.posY;
	}

	 public Bitmap getFadeTarget() {           
         return fadeTarget;
 }

	 

     /**
      * method for setting the fade targed in case the object fades to another graphical object
      */
	 public void setFadeTarget(Bitmap inextCharacter, Paint mBackGroundPaint) {
			fadeTarget=inextCharacter;
			fadePaint=mBackGroundPaint;				
		}
	 
	 public Paint getFadePaint() {
			// TODO Auto-generated method stub
		 
			return fadePaint;
		}
	 
	public abstract void draw(Canvas canvas);


	public void setPercentagePosX(float f) {
		this.posX = ViewUtils.percentWidthToPixels(Math.round(f));
		
	}
	
	public void setPercentagePosY(float f){
		this.posY = ViewUtils.percentHeightToPixels(Math.round(f));
	}
	
	
}
